<?php
// +----------------------------------------------------------------------
// | User: DaMing
// +----------------------------------------------------------------------
// | Email: 3228985941@qq.com
// +----------------------------------------------------------------------
// | Date: 2022/6/12
// +----------------------------------------------------------------------
// | Time: 16:07
// +----------------------------------------------------------------------

namespace app\dm\exceptions;


use app\dm\services\InteriorCodeService;
use think\Exception;

class BaseException extends Exception
{
    public $code       = InteriorCodeService::HTTP_INTERNAL_SERVER_ERROR;
    public $message    = '系统错误';
    public $insideCode = InteriorCodeService::SYSTEM_ERROR;

    /**
     * CustomException constructor.
     * @param null $message 异常信息
     * @param null $insideCode 内部错误码
     * @param null $code HTTP状态码
     */
    public function __construct($message = null, $insideCode = null, $code = null)
    {
        $this->message    = $message ?  $message:  $this->message;
        $this->code       = $code ? $code: $this->code;
        $this->insideCode = $insideCode ? $insideCode : $this->insideCode;
    }

    /**
     * 获取内部错误码
     * @return |null
     */
    public function getInsideCode()
    {
        return $this->insideCode;
    }
}